package com.edu.mapper;

import com.edu.bean.Book;
import com.edu.bean.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BookMapper {


    @Select("SELECT * FROM book WHERE bookId = #{bookId}")
    Book selectBookById(int bookId);

    @Select("SELECT * FROM book")
    List<Book> selectAllBook();

    @Insert("INSERT INTO book(bookName,bookWriter,bookType) VALUES(#{bookName},#{bookWriter},#{bookType})")
    int insertBook(Book book);

    @Delete("DELETE FROM book WHERE bookId = #{bookId}")
    int deleteBook(int bookId);

    @Update("UPDATE book set bookName = #{bookName},bookWriter = #{bookWriter},bookType=#{bookType} WHERE bookId =#{bookId}")
    int updateBook(Book book);

}
